/* ptpw.t  ITEM PLANNING DETAIL WRITE TRIGGER                         */
/*Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                 */
/*All rights reserved worldwide.  This is an unpublished work.        */
/*V8:ConvertMode=NoConvert*/
/*********************************************************************/
/*  Program :ptpw.t                                                  */
/*  Author  :Ben Holmes                                              */
/*  Date    :03/19/95                                                */
/*  !Description : ptp_det WRITE trigger program                     */
/*          : In order to enhance this trigger to support additional */
/*          : interfaces, add a DO-END block similar to the one      */
/*          : used for the Warehousing Interface to (1) check for the*/
/*          : need to continue processing; (2) move the relevant     */
/*          : fields to an appropriate work area; and (3) call       */
/*          : one or more subprograms to continue processing.        */
/*          : This .t program should remain short, relying on        */
/*          : subprograms to perform most of the work.               */
/*********************************************************************/
/*                             MODIFY LOG                            */
/*********************************************************************/
/*Revision 8.5          Last Modified:  03/19/95 BY: BHolmes *J0FY*  */
/*Revision 8.5          Last Modified:  07/27/96 BY: fwy     *J12B*  */
/*Revision 8.6          Last Modified:  11/20/96 BY: cjv     *K01B*  */
/*Revision 8.6          Last Modified:  01/07/97 BY: jpm     *J1DM*  */
/*Revision 9.1          Last Modified:  08/13/00 BY: *N0KQ* myb       */
/*                                                                   */
/*                                                                   */
/*********************************************************************/

TRIGGER PROCEDURE FOR WRITE OF PTP_DET OLD BUFFER OLD_PTP_DET.

/*J12B  if not can-find(first whl_mstr where whl_mstr.whl_act no-lock) */
/*J12B  then leave. */

        {mfdeclre.i }
        define new shared work-table wf_old_ptp_det like ptp_det.
        define new shared variable w-recid as recid.
        define variable w-file as character format "x(24)".


        /* Warehousing Interface processing */

        WI:
        do:

        /* If there is no active external warehouse, then do not process */
/*K01B     If the item export flag is not set, then do not process */
/*J12B*/    if not can-find(first whl_mstr no-lock
/*K01B  /*J12B*/        where whl_mstr.whl_act) */
/*K01B*/           where whl_mstr.whl_act
/*K01B*/           and whl_mstr.whl_pt_exp)
/*J12B*/    then leave WI.

        /* If no pertinent fields have been changed, then do not process */
/*J12B*/    if   (old_ptp_det.ptp_part     = ptp_det.ptp_part
/*J12B*/      and old_ptp_det.ptp_ins_rqd  = ptp_det.ptp_ins_rqd
/*J12B*/      and old_ptp_det.ptp_rev      = ptp_det.ptp_rev
/*J12B*/      and old_ptp_det.ptp_rop      = ptp_det.ptp_rop
/*J12B*/      and old_ptp_det.ptp_sfty_stk = ptp_det.ptp_sfty_stk
/*J12B*/      and old_ptp_det.ptp_user1    = ptp_det.ptp_user1
/*J12B*/      and old_ptp_det.ptp_user2    = ptp_det.ptp_user2)
/*J12B*/    then leave WI.

        /* Move old ptp_det values to work table for subsequent processing */
            assign w-recid = recid(ptp_det).
            create wf_old_ptp_det.
            if recid(wf_old_ptp_det)= -1 then .
            assign
                wf_old_ptp_det.ptp_part     = old_ptp_det.ptp_part
                wf_old_ptp_det.ptp_ins_rqd  = old_ptp_det.ptp_ins_rqd
                wf_old_ptp_det.ptp_rev      = old_ptp_det.ptp_rev
                wf_old_ptp_det.ptp_rop      = old_ptp_det.ptp_rop
                wf_old_ptp_det.ptp_sfty_stk = old_ptp_det.ptp_sfty_stk
                wf_old_ptp_det.ptp_user1    = old_ptp_det.ptp_user1
                wf_old_ptp_det.ptp_user2    = old_ptp_det.ptp_user2
            .

        /* Call subprogram to create export transactions for warehouses */
            w-file = "wiptpw.p".
/*J1DM*/ /* {gprun.i ""wiptpw.p""} */
/*J1DM*/    {gprunmo.i &module="WI"
                       &program="wiptpw.p"}

/*J12B*/end. /* WI */

/* fdn 2004/10/28 Modify Record processing */
HK:
do:
    if can-find(first dt_mstr where dt_table = "ptp_det" and dt_type = "SYNC") then
        run CreateSyncFlag(input "MOD", input recid(ptp_det), input "ptp_det").

    if not can-find ( first dt_mstr where dt_table = "ptp_det" and dt_type = "MOD" ) then leave HK.
    
    if not can-find ( first wf_old_ptp_det ) then do:
        create wf_old_ptp_det.
        if recid(wf_old_ptp_det)= -1 then .
    end.
    
    buffer-copy old_ptp_det to wf_old_ptp_det no-error.

    for each dt_mstr no-lock where dt_table = "ptp_det" and dt_type = "MOD" :
    
        case dt_field :

            when "ptp_part" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptp_det.ptp_part, input ptp_det.ptp_part,
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_site" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptp_det.ptp_site, input ptp_det.ptp_site,
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_batch" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_batch), input string(ptp_det.ptp_batch),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_bom_code" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptp_det.ptp_bom_code, input ptp_det.ptp_bom_code,
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp__qad01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp__qad01), input string(ptp_det.ptp__qad01),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_buyer" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptp_det.ptp_buyer, input ptp_det.ptp_buyer,
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_cum_lead" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_cum_lead), input string(ptp_det.ptp_cum_lead),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp__qad02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp__qad02), input string(ptp_det.ptp__qad02),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_ins_lead" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_ins_lead), input string(ptp_det.ptp_ins_lead),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_ins_rqd" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_ins_rqd), input string(ptp_det.ptp_ins_rqd),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_iss_pol" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_iss_pol), input string(ptp_det.ptp_iss_pol),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_mfg_lead" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_mfg_lead), input string(ptp_det.ptp_mfg_lead),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_ms" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_ms), input string(ptp_det.ptp_ms),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_ord_max" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_ord_max), input string(ptp_det.ptp_ord_max),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_ord_min" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_ord_min), input string(ptp_det.ptp_ord_min),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_ord_mult" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_ord_mult), input string(ptp_det.ptp_ord_mult),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_ord_per" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_ord_per), input string(ptp_det.ptp_ord_per),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_ord_pol" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptp_det.ptp_ord_pol, input ptp_det.ptp_ord_pol,
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_ord_qty" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_ord_qty), input string(ptp_det.ptp_ord_qty),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_phantom" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_phantom), input string(ptp_det.ptp_phantom),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_plan_ord" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_plan_ord), input string(ptp_det.ptp_plan_ord),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_pm_code" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptp_det.ptp_pm_code, input ptp_det.ptp_pm_code,
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_pur_lead" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_pur_lead), input string(ptp_det.ptp_pur_lead),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_rev" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptp_det.ptp_rev, input ptp_det.ptp_rev,
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_rop" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_rop), input string(ptp_det.ptp_rop),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_routing" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptp_det.ptp_routing, input ptp_det.ptp_routing,
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_run" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_run), input string(ptp_det.ptp_run),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_run_ll" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_run_ll), input string(ptp_det.ptp_run_ll),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_setup" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_setup), input string(ptp_det.ptp_setup),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_setup_ll" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_setup_ll), input string(ptp_det.ptp_setup_ll),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_sfty_stk" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_sfty_stk), input string(ptp_det.ptp_sfty_stk),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_sfty_tme" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_sfty_tme), input string(ptp_det.ptp_sfty_tme),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_timefnce" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_timefnce), input string(ptp_det.ptp_timefnce),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_user1" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptp_det.ptp_user1, input ptp_det.ptp_user1,
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_user2" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptp_det.ptp_user2, input ptp_det.ptp_user2,
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_vend" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptp_det.ptp_vend, input ptp_det.ptp_vend,
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_yld_pct" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_yld_pct), input string(ptp_det.ptp_yld_pct),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_assay" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_assay), input string(ptp_det.ptp_assay),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_grade" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptp_det.ptp_grade, input ptp_det.ptp_grade,
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_ll_bom" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_ll_bom), input string(ptp_det.ptp_ll_bom),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_eco_pend" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_eco_pend), input string(ptp_det.ptp_eco_pend),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_rollup" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_rollup), input string(ptp_det.ptp_rollup),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_added" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_added), input string(ptp_det.ptp_added),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_draw" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptp_det.ptp_draw, input ptp_det.ptp_draw,
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_trantype" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptp_det.ptp_trantype, input ptp_det.ptp_trantype,
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp__chr01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptp_det.ptp__chr01, input ptp_det.ptp__chr01,
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp__chr02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptp_det.ptp__chr02, input ptp_det.ptp__chr02,
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp__chr03" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptp_det.ptp__chr03, input ptp_det.ptp__chr03,
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp__chr04" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptp_det.ptp__chr04, input ptp_det.ptp__chr04,
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp__chr05" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptp_det.ptp__chr05, input ptp_det.ptp__chr05,
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp__chr06" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptp_det.ptp__chr06, input ptp_det.ptp__chr06,
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp__chr07" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptp_det.ptp__chr07, input ptp_det.ptp__chr07,
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp__chr08" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptp_det.ptp__chr08, input ptp_det.ptp__chr08,
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp__chr09" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptp_det.ptp__chr09, input ptp_det.ptp__chr09,
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp__chr10" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptp_det.ptp__chr10, input ptp_det.ptp__chr10,
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp__dte01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp__dte01), input string(ptp_det.ptp__dte01),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp__dte02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp__dte02), input string(ptp_det.ptp__dte02),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp__dec01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp__dec01), input string(ptp_det.ptp__dec01),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp__dec02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp__dec02), input string(ptp_det.ptp__dec02),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp__log01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp__log01), input string(ptp_det.ptp__log01),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp__log02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp__log02), input string(ptp_det.ptp__log02),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_ll_drp" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_ll_drp), input string(ptp_det.ptp_ll_drp),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp__qad05" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp__qad05), input string(ptp_det.ptp__qad05),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_po_site" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptp_det.ptp_po_site, input ptp_det.ptp_po_site,
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp__qad04" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp__qad04), input string(ptp_det.ptp__qad04),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp__qad03" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp__qad03), input string(ptp_det.ptp__qad03),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_mod_date" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_mod_date), input string(ptp_det.ptp_mod_date),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_userid" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptp_det.ptp_userid, input ptp_det.ptp_userid,
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_network" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptp_det.ptp_network, input ptp_det.ptp_network,
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_rollup_id" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptp_det.ptp_rollup_id, input ptp_det.ptp_rollup_id,
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_mfg_pct" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_mfg_pct), input string(ptp_det.ptp_mfg_pct),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_pur_pct" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_pur_pct), input string(ptp_det.ptp_pur_pct),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_drp_pct" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_drp_pct), input string(ptp_det.ptp_drp_pct),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_pou_code" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptp_det.ptp_pou_code, input ptp_det.ptp_pou_code,
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_wks_avg" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_wks_avg), input string(ptp_det.ptp_wks_avg),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_wks_max" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_wks_max), input string(ptp_det.ptp_wks_max),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_wks_min" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_wks_min), input string(ptp_det.ptp_wks_min),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_pick_logic" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_pick_logic), input string(ptp_det.ptp_pick_logic),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_joint_type" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptp_det.ptp_joint_type, input ptp_det.ptp_joint_type,
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_btb_type" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptp_det.ptp_btb_type, input ptp_det.ptp_btb_type,
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_cfg_type" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptp_det.ptp_cfg_type, input ptp_det.ptp_cfg_type,
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_op_yield" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_op_yield), input string(ptp_det.ptp_op_yield),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_run_seq1" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptp_det.ptp_run_seq1, input ptp_det.ptp_run_seq1,
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_run_seq2" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptp_det.ptp_run_seq2, input ptp_det.ptp_run_seq2,
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_atp_enforcement" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_ptp_det.ptp_atp_enforcement, input ptp_det.ptp_atp_enforcement,
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

            when "ptp_atp_family" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_ptp_det.ptp_atp_family), input string(ptp_det.ptp_atp_family),
                    input recid(ptp_det), input ptp_det.ptp_part, input ptp_det.ptp_site, input "", input "",
                    input "", input "", input "", input "").

        end.

    end.
end.

{hkdttrans.i}
